/*
 * Categories_EditView.java
 * Final Project Example
 * Created on Oct 9, 2014, 12:48:12 PM
 * by Fairul Filza with Team FA_PemrogrammanLanjut
 */

package Views;

// <editor-fold defaultstate="collapsed" desc="Import Code">
import Controllers.Category_Controller;
import Controllers.MasterCd_Controller;
import Interfaces.ViewsProcess_Interface;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.Frame;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;
// </editor-fold>

/** @author PemrogrammanLanjut_LABIV_TI_05~09 */
public class Category_EditView extends JDialog implements ViewsProcess_Interface {
    private JButton BtnUpload;
    private JButton BtnSave;
    private JButton BtnEdit;
    private JButton BtnCancel;
    private JPanel PnlFront;
//    private JComboBox CboCategory;
//    private JTextField TxtStock;
//    private JTextField TxtPrice;
    private JTextField TxtDetail; 
    private JLabel LblWallpaper;
    private ImageIcon Image;
//    private JTextField TxtTitle;
    private JTextField TxtCodeCd;

    // <editor-fold defaultstate="collapsed" desc="Constructor Code">
    public Category_EditView(Frame parent, String code) {
        super(parent, true);
        PnlFront = new JPanel();
        BtnUpload = new JButton();
        BtnSave = new JButton();
        BtnEdit = new JButton();
        BtnCancel = new JButton();
//        CboCategory = new JComboBox();
//        TxtStock = new JTextField();
//        TxtPrice = new JTextField();
//        TxtTitle = new JTextField();
        TxtCodeCd = new JTextField();
        TxtDetail = new JTextField();
        LblWallpaper = new JLabel();

        initFrameProcess();
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Getter and Setter Code">
    
     public JButton getBtnUpload() {
        return BtnUpload;
    }

    public void setBtnUpload(JButton BtnUpload) {
        this.BtnUpload = BtnUpload;
    }
    public JButton getBtnSave() {
        return BtnSave;
    }

    public void setBtnSave(JButton BtnSave) {
        this.BtnSave = BtnSave;
    }
    public JButton getBtnEdit() {
        return BtnEdit;
    }

    public void setBtnEdit(JButton BtnEdit) {
        this.BtnEdit = BtnEdit;
    }

    public JButton getBtnCancel() {
        return BtnCancel;
    }

    public void setBtnCancel(JButton BtnCancel) {
        this.BtnCancel = BtnCancel;
    }

    public JLabel getLblWallpaper() {
        return LblWallpaper;
    }

    public void setLblWallpaper(JLabel LblWallpaper) {
        this.LblWallpaper = LblWallpaper;
    }

    public JPanel getPnlFront() {
        return PnlFront;
    }

    public void setPnlFront(JPanel PnlFront) {
        this.PnlFront = PnlFront;
    }

//    public JTextField getTxtTitle() {
//        return TxtTitle;
//    }
//
//    public void setTxtTitle(JTextField TxtTitle) {
//        this.TxtTitle = TxtTitle;
//    }
    
    

    public JTextField getTxtCodeCd() {
        return TxtCodeCd;
    }

    public void setTxtCodeCd(JTextField TxtCodeCd) {
        this.TxtCodeCd = TxtCodeCd;
    }

//    public JComboBox getCboCategory() {
//        return CboCategory;
//    }
//
//    public void setCboCategory(JComboBox CboCategory) {
//        this.CboCategory = CboCategory;
//    }
//
//    public JTextField getTxtStock() {
//        return TxtStock;
//    }
//
//    public void setTxtStock(JTextField TxtStock) {
//        this.TxtStock = TxtStock;
//    }
//
//    public JTextField getTxtPrice() {
//        return TxtPrice;
//    }
//
//    public void setTxtPrice(JTextField TxtPrice) {
//        this.TxtPrice = TxtPrice;
//    }

    public JTextField getTxtDetail() {
        return TxtDetail;
    }

    public void setTxtDetail(JTextField TxtDetail) {
        this.TxtDetail = TxtDetail;
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Method Code">
    private void initFrameProcess() {
        initComponents();
        eventControllers();
        imageControllers();
    }

    @Override
    public void initComponents() {
        Font FontStyle = new Font("Tahoma", 1, 12);

        this.setTitle("Categori Editor");
        this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        this.getContentPane().setLayout(new AbsoluteLayout());
        this.getContentPane().add(PnlFront, new AbsoluteConstraints(0, 0, 400, 194));

        PnlFront.setLayout(null);
        PnlFront.setBackground(new Color(0, 0, 0));
        PnlFront.setOpaque(true);

//        TxtTitle.setOpaque(true);
//        TxtTitle.setBorder(null);
//        TxtTitle.setHorizontalAlignment(JLabel.LEADING);
//        TxtTitle.setFont(FontStyle);
//        PnlFront.add(TxtTitle);
//        TxtTitle.setBounds(124, 76, 204, 19);

        TxtCodeCd.setOpaque(true);
        TxtCodeCd.setBorder(null);
        TxtCodeCd.setHorizontalAlignment(JLabel.LEADING);
        TxtCodeCd.setFont(FontStyle);
        PnlFront.add(TxtCodeCd);
        TxtCodeCd.setBounds(124+19,183-109,206,18);
        
        TxtDetail.setOpaque(true);
        TxtDetail.setBorder(null);
        TxtDetail.setHorizontalAlignment(JLabel.LEADING);
        TxtDetail.setFont(FontStyle);
        PnlFront.add(TxtDetail);
        TxtDetail.setBounds(124+19, 209-109, 206, 18);
        
        BtnSave.setOpaque(false);
        BtnSave.setBorderPainted(false);
        BtnSave.setContentAreaFilled(false);
        BtnSave.setBorder(null);
        BtnSave.setVisible(true);
        BtnSave.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnSave);
        BtnSave.setBounds(113, 359-75-131, 90, 30);

        BtnEdit.setOpaque(false);
        BtnEdit.setBorderPainted(false);
        BtnEdit.setContentAreaFilled(false);
        BtnEdit.setBorder(null);
        BtnEdit.setVisible(!true);
        BtnEdit.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnEdit);
        BtnEdit.setBounds(113, 359-75-131, 90, 30);
        
        BtnCancel.setOpaque(false);
        BtnCancel.setBorderPainted(false);
        BtnCancel.setContentAreaFilled(false);
        BtnCancel.setBorder(null);
        BtnCancel.setVisible(true);
        BtnCancel.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnCancel);
        BtnCancel.setBounds(209, 359-75-131, 90, 30);

        LblWallpaper.setText(null);
        LblWallpaper.setBackground(new Color(250, 250, 0));
        LblWallpaper.setOpaque(true);
        PnlFront.add(LblWallpaper);
        LblWallpaper.setBounds(0, 0, 400, 194);

        pack();
        this.setLocationRelativeTo(this);
    }

    @Override
    public void eventControllers() {
        Category_Controller ControlPanel = new Category_Controller(this);
        BtnSave.addActionListener(ControlPanel.EditButton_Listener);
        BtnEdit.addActionListener(ControlPanel.EditButton_Listener);
        BtnCancel.addActionListener(ControlPanel.EditButton_Listener);
//        CboCategory.addActionListener(ControlPanel.EditButton_Listener);
    }

    @Override
    public void imageControllers() {
        Image = new ImageIcon(getClass().getResource("/Images/New Category.png"));
        LblWallpaper.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/save.png"));
        BtnSave.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/save.png"));
        BtnEdit.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/cancel3.png"));
        BtnCancel.setIcon(Image);
    }
    // </editor-fold>
}
// End of Code